package com.zd.service.reply.impl;

import com.zd.domain.Reply;
import com.zd.mapper.CommentMapper;
import com.zd.mapper.ReplyMapper;
import com.zd.mapper.UserMapper;
import com.zd.service.reply.ReplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ReplyServiceImpl implements ReplyService {

    @Autowired
    private ReplyMapper replyMapper;

    @Autowired
    private CommentMapper commentMapper;

    @Autowired
    private UserMapper userMapper;


    /**
     * 根据commentId查询所有回复
     * @param commentId
     * @return
     */
    @Override
    public List<Reply> findReplys(Integer commentId) {
        return replyMapper.findReplys(commentId);
    }

    /**
     * 添加评论
     * @param reply
     * @return
     */
    @Override
    public int saveReply(Reply reply) {
        return replyMapper.saveReply(reply);
    }
}
